<?php

use Illuminate\Support\Facades\Route;

Route::post('auth/login', 'AuthController@login')->name('auth.login');

Route::group(['middleware' => 'auth:api'], function () {
    Route::resource('users', 'UsersController', ['only' => ['index', 'show', 'store', 'update']]);
    Route::delete('users', 'UsersController@destroy')->name('users.destroy');

    Route::resource('articles', 'ArticlesController', ['only' => ['index', 'show', 'store', 'update']]);
    Route::delete('articles', 'ArticlesController@destroy')->name('articles.destroy');

    Route::get('categories/all', 'CategoriesController@all')->name('categories.all');
    Route::resource('categories', 'CategoriesController', ['only' => ['index', 'show', 'store', 'update']]);
    Route::delete('categories', 'CategoriesController@destroy')->name('categories.destroy');

    Route::post('filesystem/image', 'FilesystemController@uploadImage')->name('filesystem.image.upload');

    Route::resource('html_tags', 'HtmlTagsController', ['only' => ['index', 'show', 'store', 'update']]);
    Route::delete('html_tags', 'HtmlTagsController@destroy')->name('html_tags.destroy');

    Route::resource('keywords', 'KeywordsController', ['only' => ['index']]);
    Route::delete('keywords', 'KeywordsController@destroy')->name('keywords.destroy');

    Route::resource('permissions', 'PermissionsController', ['only' => ['index', 'show', 'store', 'update']]);
    Route::delete('permissions', 'PermissionsController@destroy')->name('permissions.destroy');

    Route::get('roles/all', 'RolesController@all')->name('roles.all');
    Route::resource('roles', 'RolesController', ['only' => ['index', 'show', 'store', 'update']]);
    Route::delete('roles', 'RolesController@destroy')->name('roles.destroy');

    Route::get('tags/all', 'TagsController@all')->name('tags.all');
    Route::resource('tags', 'TagsController', ['only' => ['index', 'show', 'store', 'update']]);
    Route::delete('tags', 'TagsController@destroy')->name('tags.destroy');

    Route::get('setting_groups/all', 'SettingGroupsController@all')->name('setting_groups.all');
    Route::delete('setting_groups', 'SettingGroupsController@destroy')->name('setting_groups.destroy');
    Route::resource('setting_groups', 'SettingGroupsController', ['only' => ['index', 'store', 'update', 'show']]);

    Route::get('settings/all', 'SettingsController@all')->name('settings.all');
    Route::delete('settings', 'SettingsController@destroy')->name('settings.destroy');
    Route::put('settings/batch', 'SettingsController@batchUpdate')->name('settings.batchUpdate');
    Route::resource('settings', 'SettingsController', ['only' => ['store', 'destroy', 'update', 'show']]);

    Route::resource('users', 'UsersController', ['only' => ['index', 'show', 'store', 'update']]);
    Route::delete('users', 'UsersController@destroy')->name('users.destroy');

    Route::post('auth/logout', 'AuthController@logout')->name('auth.logout');
    Route::post('auth/refresh', 'AuthController@refresh')->name('auth.refresh');
    Route::get('auth/me', 'AuthController@me')->name('auth.me');
    Route::get('auth/keywords', 'AuthController@keywords')->name('auth.keywords');
});
